package me.twoday.library.mine.component;

import me.twoday.library.mine.adapter.SettingListAdapter;
import me.twoday.library.mine.handler.SettingHandler;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.widget.ListView;

/**
 * SettingActivity만을 위한 SettingListView입니다.  
 * 
 * @author 김학성
 * @since 2012. 4. 18.
 */
@SuppressWarnings("unused")
public class SettingListView extends ListView 
{
	private static final String LIST_VIEW_BACKGROUND_COLOR = "#ededed";
	private static final String LIST_VIEW_DIVIDER_COLOR = "#aeaeae";
	private static final String LIST_VIEW_TRANSPARENT_COLOR = "#00000000";
	
	private Activity mParentActivity;
	private SettingHandler mListHandler;
	private SettingListAdapter mListAdapter;
	//private boolean mAutoSetAdapter = true;
	
	public SettingListView(SettingHandler listHandler) 
	{
		super(listHandler.getActivity());

		// 멤버 변수 할당 
		this.mParentActivity = listHandler.getActivity();
		this.mListHandler = listHandler;
		
		// 기본 설정
		setBackgroundColor(Color.parseColor(LIST_VIEW_BACKGROUND_COLOR));
		setDivider(new ColorDrawable(Color.parseColor(LIST_VIEW_DIVIDER_COLOR)));
		setCacheColorHint(Color.parseColor(LIST_VIEW_TRANSPARENT_COLOR));
		setDividerHeight(1);
		
		// 어뎁터 생성
		this.mListAdapter = new SettingListAdapter(listHandler);
		listHandler.setListAdapter(mListAdapter);
		listHandler.setListView(this);
		setAdapter(mListAdapter);
	}
}
